package com.csdj.t309;

import com.csdj.t309.entity.TSysUser;
import com.csdj.t309.mapper.UserMapper;
import com.csdj.t309.utils.FileUtil;
import com.csdj.t309.utils.RandomUtil;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class MybatisTest {
    int count = 0;
    public static void main(String[] args) throws IOException {
//        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
//        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
//        SqlSession sqlSession = factory.openSession(true);
//        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
//
//        for (int j = 0; j < 1000; j++) {
//            List<TSysUser> users = new ArrayList<>();
//            for (int i = 0; i < 10000; i++) {
//                TSysUser tSysUser = new TSysUser();
//                tSysUser.setRealName(FileUtil.getName());
//                tSysUser.setAccount(RandomUtil.genRandStr(8));
//                tSysUser.setRoleId(RandomUtil.genRoleId());
//                tSysUser.setPassword(RandomUtil.genRandStr(12));
//                tSysUser.setAddress(RandomUtil.genRandStr(16));
//                users.add(tSysUser);
//            }
//            Map<String,Object> map = new HashMap<>();
//            userMapper.inserts(users);
//        }
        MybatisTest test = new MybatisTest();
        test.stackTest();
    }



    public void stackTest(){
        double[] arr = new double[1024];
        for (int i = 0; i < 1024; i++) {
            arr[i] = Math.random();
        }
        count++;
        System.out.println(count);
        stackTest();
    }







}
